package com.rx.mgt.dao;

import com.rx.mgt.dao.base.ManagementHibernateDaoBase;
import com.rx.mgt.domain.EmailUserLoginCounts;
import org.hibernate.Query;
import org.hibernate.transform.Transformers;
import org.springframework.stereotype.Repository;

import java.util.Map;

/**
 * Created by zxj on 2017/8/14.
 */
@Repository
public class EmailUserLoginCountsDao extends ManagementHibernateDaoBase<EmailUserLoginCounts,Integer> {



    public Map<String,Object> querySysPropety() {
        String sql = "select (select count(1)  from domain_info_ext m where m.status='Y') as domainCount,(select count(1) from user_info_ext t where t.status='Y') as emailCount from dual";
        Query query = template.getSessionFactory().getCurrentSession().createSQLQuery(sql).setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP);
        return (Map<String,Object>)query.uniqueResult();

    }
}
